package com.rht.gulimallorder.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.RequestMapping;

import com.rht.gulimallorder.entity.MqMessageEntity;
import com.rht.gulimallorder.service.MqMessageService;
import com.rht.common.utils.PageUtils;
import com.rht.common.utils.R;




/**
 * 
 *
 * @author rht
 * @email rht@qq.com
 * @date 2024-11-06 17:28:44
 */

@RestController
@RequestMapping("gulimallorder/mqmessage")
public class MqMessageController {
    @Autowired
    private MqMessageService mqMessageService;

    /**
     * 列表
     */
    @Operation(summary ="处理查询全部,分页查询的请求")
    @RequestMapping("/list")
      public R list(@RequestParam Map<String, Object> params){
        PageUtils page = mqMessageService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */

    @Operation(summary ="信息")
    @RequestMapping("/info/{messageId}")
      public R info(@PathVariable("messageId") String messageId){
		MqMessageEntity mqMessage = mqMessageService.getById(messageId);

        return R.ok().put("mqMessage", mqMessage);
    }

    /**
     * 保存
     */
    @Operation(summary ="保存")
    @RequestMapping("/save")
     public R save(@RequestBody MqMessageEntity mqMessage){
		mqMessageService.save(mqMessage);

        return R.ok();
    }

    /**
     * 修改
     */
    @Operation(summary ="修改")
    @RequestMapping("/update")
     public R update(@RequestBody MqMessageEntity mqMessage){
		mqMessageService.updateById(mqMessage);

        return R.ok();
    }

    /**
     * 删除
     */
    @Operation(summary ="删除")
    @RequestMapping("/delete")
      public R delete(@RequestBody String[] messageIds){
		mqMessageService.removeByIds(Arrays.asList(messageIds));

        return R.ok();
    }

}
